package chapter04

import chisel3._
import chisel3.util._

class MyCounter3 extends Module {
  val io = IO(new Bundle {
    val en = Input(Bool())
    val out = Output(UInt(8.W))
    val valid = Output(Bool())
  })
  val cnt = Counter(233)
  when(io.en) {
    cnt.inc()
  }
  val a = cnt.value
  val b = cnt.value === cnt.n.U
  io.out := a
  io.valid := b
}
